# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity study project
File Name: read_file.py
Author: kij
Create Date: 2021/2/16
-------------------------------------------------
"""
import os
import conf.config


def read_text_file():
	with open(os.path.join(conf.config.BASE_DIR, "files", "consoleText.txt"), mode='r', encoding='utf-8') as file_text:
		for line in file_text:
			print(line)


# 按字节读取
def read_text_file_byte():
	file_size = os.path.getsize(os.path.join(conf.config.BASE_DIR, "files", "consoleText.txt"))
	read_size = 0
	with open(os.path.join(conf.config.BASE_DIR, "files", "consoleText.txt"), mode='rb') as file_text:
		while read_size < file_size:
			data = file_text.read(1)
			print(data,end="")
			read_size += len(data)
